package com.shuiyun.jtt.enums;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 消息推送线程池
 *
 * @author shuiyun
 */
public enum PushMessageThreadPool {

    // 单例
    instance;

    /**
     * 获取数据推送的线程池
     *
     * @return 线程池
     */
    public ThreadPoolExecutor getPushMessageThreadPool() {
        return new ThreadPoolExecutor(
                10,
                20,
                60,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(100),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy()
        );
    }


}
